package br.com.cdto.entity;

import java.io.Serializable;
import java.util.Calendar;

import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "ORGAO_TYPE")
public abstract class Orgao implements Serializable {
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy= GenerationType.AUTO)
	private Long id;
	@OneToOne(cascade=CascadeType.PERSIST)
	private Doador doador;
	@OneToOne
	private Receptor receptor;
	
	@Temporal(TemporalType.TIMESTAMP)
	private Calendar dataRetirada;
	private String status;

	public Orgao(){
		super();
	}

	public Calendar getDataRetirada() {
		return dataRetirada;
	}

	public void setDataRetirada(Calendar dataRetirada) {
		this.dataRetirada = dataRetirada;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Doador getDoador() {
		if(doador == null){
			doador = new Doador();
		}
		return doador;
	}

	public void setDoador(Doador doador) {
		this.doador = doador;
	}

	public Receptor getReceptor() {
		return receptor;
	}

	public void setReceptor(Receptor receptor) {
		this.receptor = receptor;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	
}
